﻿@using Batman.Cms.Domains;
@model Abp.Application.Services.Dto.PagedResultDto<QrCode>;
@{
    ViewBag.JsUrl = "/cms/js/weixin-qrcode-index.js";
    ViewBag.Title = "微信公众号资料列表";
}
<div class="panel panel-default">
    <div class="panel-heading clearfix">
        <div class="pull-left">带参二维码</div>
        <div class="pull-right">
            <a href="/cms/weixinQrCode/create">
                <i class="el-icon-plus"></i>
                <span>新建带参二维码</span>
            </a>
        </div>
    </div>
    <div class="panel-body">
        <div id="weixin-qr-code-index">
            <table class="table table-bordered middle-table">
                <colgroup>
                    <col width="120" />
                    <col />
                    <col width="150" />
                    <col />
                    <col width="140" />
                </colgroup>
                <thead>
                    <tr>
                        <th>二维码</th>
                        <th>二维码名称</th>
                        <th>二维码类型</th>
                        <th>二维码参数</th>
                        <th>二维码失效时间</th>
                        <th></th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model.Items)
                    {
                        <tr>
                            <td>
                                <img style="width:100px" src="@item.Url" alt="@item.Name" />
                                <a href="@item.Url" style="width:100%" class="btn btn-default btn-mini" target="_blank">下载</a>
                            </td>
                            <td>@item.Name</td>
                            <td>
                                <span>@item.Type</span>
                                @if (item.Type != QrCodeType.永久二维码 && item.ExpiredAt.HasValue && DateTime.Now > item.ExpiredAt.Value)
                                {
                                    <span class="text-danger">(已过期)</span>
                                }
                            </td>
                            <td>@item.ActionInfo</td>
                            <td>
                                @if (item.Type == QrCodeType.临时二维码)
                                {
                                    <span>@item.ExpiredAt</span>
                                }
                                else
                                {
                                    <span>永久有效</span>
                                }
                            </td>
                            <td></td>
                        </tr>
                    }
                </tbody>
            </table>
            <script>var total = @Model.TotalCount </script>
            <common-pagination v-model="page" :total="total" @@change="load"></common-pagination>
        </div>
    </div>
    <div class="panel-footer clearfix">
        <div class="pull-right">
            <a href="/cms/weixinMpAccount/create">
                <i class="el-icon-plus"></i>
                <span>新建微信公众号资料</span>
            </a>
        </div>
    </div>
</div>